﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;

namespace QLBH.Models
{
   public class OrdersModel:ModelBase
    {
        private int id;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        private DateTime created_at;

        public DateTime Created_at
        {
            //get { return created_at; }
            set { created_at = value; }
        }
        private DateTime updated_at;

        public DateTime Updated_at
        {
            get { return updated_at; }
            set { updated_at = value; }
        }
        private String order_number;

        public String Order_number
        {
            get { return order_number; }
            set { order_number = value; }
        }
        private int warehouse_id;

        public int Warehouse_id
        {
            get { return warehouse_id; }
            set { warehouse_id = value; }
        }
        
       private float total_money;

       public float Total_money
       {
           get { return total_money; }
           set { total_money = value; }
       }
       private int user_id;

       public int User_id
       {
           get { return user_id; }
           set { user_id = value; }
       }
       private String warehouse_name;

       public String Warehouse_name
       {
           get { return warehouse_name; }
           set { warehouse_name = value; }
       }
       private String user_name;

       public String User_name
       {
           get { return user_name; }
           set { user_name = value; }
       }
      
       private String status;

       public String Status
       {
           get { return status; }
           set { status = value; }
       }
       private List<OrdersDetailModel> details;

       public List<OrdersDetailModel> Details
       {
           get { return details; }
           set { details = value; }
       }

        public OrdersModel()
        {
            details = new List<OrdersDetailModel>();
        }
        public override NameValueCollection PrepareValue()
        {
            NameValueCollection data = new NameValueCollection();
           

            data.Add("order_number", this.Order_number.ToString());
            data.Add("warehouse_id", this.Warehouse_id.ToString());
            data.Add("user_id", this.User_id.ToString());
            data.Add("total_money", this.Total_money.ToString());
            data.Add("status", this.Status);
            foreach (var item in Details)
            {
            data.Add("good_id", item.Good_id.ToString());
            data.Add("import_price", item.Import_price.ToString());
            data.Add("number", item.Number.ToString());
            data.Add("tax", item.Tax.ToString());
            data.Add("discount", item.Discount.ToString());
            data.Add("comments", item.Comments.ToString());
            }

            return data;
        }
    }
}
